package my.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@ResponseBody
public class MyControllerV2 {
    @GetMapping("/hello")
    public String hello(String name) throws Exception {
        System.out.println("Hello, " + name);
        return "Hello, " + name;
    }
    @PostMapping("/hello2")
    public String hello2(@RequestBody MyDto myDto) throws Exception {
        System.out.println("Hello, " + myDto.getName());
        return "Hello, " + myDto.getName();
    }
}
